home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!spool.mu.edu!sol.ctr.columbia.edu!lll-winken!sun-barr!newstop!texsun!male!jethro!exodus!mipsdal.mips.com
- From: riley@mipsdal.mips.com (Riley Rainey)
- Newsgroups: comp.sources.x
- Subject: v12i006: acm - X aerial combat simulation, Part01/09
- Message-ID: <csx-12i006:acm@uunet.UU.NET>
- Date: 2 Mar 91 08:31:58 GMT
- Sender: news@exodus.Eng.Sun.COM
- Lines: 2462
- Approved: argv@sun.com
- Posted: Sat Mar 2 02:31:58 1991
-
- Submitted-by: riley@mipsdal.mips.com (Riley Rainey)
- Posting-number: Volume 12, Issue 6
- Archive-name: acm/part01
-
- Acm is a multiplayer jet aerial combat simulation for X and Unix. It is
- written to run on a variety of platforms.
-
- Players can fly F-16's and Mig-23's against one another, engaging in aerial
- combat with heat seeking missiles and cannons.
-
- This revision contains many enhancements to the 1.1 code that was posted
- to comp.sources.x last Fall. An eleven page user's guide in PostScript format
- has been included, as well.
-
- Riley Rainey
- February 14, 1991
-
- ---> CUT HERE CUT HERE CUT HERE <---
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 9)."
- # Contents: acm acm/Imakefile acm/V acm/V/Imakefile acm/V/lib
- # acm/V/lib/Imakefile acm/V/lib/VAllocColor.c acm/V/lib/VCloseVp.c
- # acm/V/lib/VCopyPoly.c acm/V/lib/VCrPoints.c acm/V/lib/VCrPoly.c
- # acm/V/lib/VCrossProd.c acm/V/lib/VDispObjects.c
- # acm/V/lib/VDotProd.c acm/V/lib/VDrawPoly.c acm/V/lib/VDrawString.c
- # acm/V/lib/VExpBuffer.c acm/V/lib/VEyeToScr.c acm/V/lib/VFillPoly.c
- # acm/V/lib/VGetPlanes.c acm/V/lib/VIdentMat.c acm/V/lib/VMatDet.c
- # acm/V/lib/VMatInvert.c acm/V/lib/VMatMult.c acm/V/lib/VPrintPoly.c
- # acm/V/lib/VReadObject.c acm/V/lib/VResizeVp.c acm/V/lib/VRotate.c
- # acm/V/lib/VTrans.c acm/V/lib/VTransPoly.c acm/V/lib/VWorldToScr.c
- # acm/V/lib/VWriteObject.c acm/V/lib/Vmalloc.c acm/V/lib/strdup.c
- # acm/V/test acm/V/test/Imakefile acm/V/test/fixf16.c
- # acm/V/test/fixmig.c acm/acm.def acm/fsim acm/fsim/V2tgif.c
- # acm/fsim/aim-9 acm/fsim/bullet acm/fsim/damage.h
- # acm/fsim/droneCalc.c acm/fsim/flaps0.xbm acm/fsim/flaps2.xbm
- # acm/fsim/flaps3.xbm acm/fsim/getStick.c acm/fsim/header
- # acm/fsim/manifest.h acm/fsim/mtn acm/fsim/patchlevel.h
- # acm/fsim/placeCraft.c acm/fsim/rwy2 acm/fsim/scale.h
- # acm/fsim/tower acm/fsim/transpose.c acm/fsim/update.c
- # acm/fsim/weapon.c acm/install-objects
- # Wrapped by riley@mipsdal on Thu Feb 14 10:09:15 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test ! -d 'acm' ; then
- echo shar: Creating directory \"'acm'\"
- mkdir 'acm'
- fi
- if test -f 'acm/Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/Imakefile'\"
- else
- echo shar: Extracting \"'acm/Imakefile'\" \(361 characters\)
- sed "s/^X//" >'acm/Imakefile' <<'END_OF_FILE'
- X/*
- X * To build acm:
- X *
- X * If you have imake:
- X *
- X * % imake Makefile
- X * % make Makefiles
- X * % make all
- X *
- X * If you don't, first tailor the Makefiles to your system, then:
- X *
- X * % make all
- X */
- X
- X#include "./acm.def"
- X
- X#define IHaveSubdirs
- X#define PassCDebugFlags CDEBUFLAGS='$(CDEBUGFLAGS)'
- X
- XSUBDIRS= V fsim
- X
- XMakeSubdirs($(SUBDIRS))
- XDependSubdirs($(SUBDIRS))
- END_OF_FILE
- if test 361 -ne `wc -c <'acm/Imakefile'`; then
- echo shar: \"'acm/Imakefile'\" unpacked with wrong size!
- fi
- # end of 'acm/Imakefile'
- fi
- if test ! -d 'acm/V' ; then
- echo shar: Creating directory \"'acm/V'\"
- mkdir 'acm/V'
- fi
- if test -f 'acm/V/Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/Imakefile'\"
- else
- echo shar: Extracting \"'acm/V/Imakefile'\" \(196 characters\)
- sed "s/^X//" >'acm/V/Imakefile' <<'END_OF_FILE'
- X#include "../acm.def"
- X
- X#define IHaveSubdirs
- X#define PassCDebugFlags CDEBUFLAGS='$(CDEBUGFLAGS)'
- X
- XSUBDIRS= lib /* don't build test by default */
- X
- XMakeSubdirs($(SUBDIRS))
- XDependSubdirs($(SUBDIRS))
- END_OF_FILE
- if test 196 -ne `wc -c <'acm/V/Imakefile'`; then
- echo shar: \"'acm/V/Imakefile'\" unpacked with wrong size!
- fi
- # end of 'acm/V/Imakefile'
- fi
- if test ! -d 'acm/V/lib' ; then
- echo shar: Creating directory \"'acm/V/lib'\"
- mkdir 'acm/V/lib'
- fi
- if test -f 'acm/V/lib/Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/Imakefile'\"
- else
- echo shar: Extracting \"'acm/V/lib/Imakefile'\" \(1148 characters\)
- sed "s/^X//" >'acm/V/lib/Imakefile' <<'END_OF_FILE'
- X#include "../../acm.def"
- X
- XSRCS = \
- X VOpenVp.c \
- X VResizeVp.c \
- X VCloseVp.c \
- X VGetEyeSpace.c \
- X VGetPlanes.c \
- X VReadObject.c \
- X VWriteObject.c \
- X VAllocColor.c \
- X VBindColors.c \
- X VExpBuffer.c \
- X VCrPoly.c \
- X VCrPoints.c \
- X VCopyPoly.c \
- X VDrawPoly.c \
- X VFillPoly.c \
- X VDrawString.c \
- X VClipPoly.c \
- X VDotProd.c \
- X VCrossProd.c \
- X VRotate.c \
- X VTransPoly.c \
- X VWorldToScr.c \
- X VEyeToScr.c \
- X VTrans.c \
- X VIdentMat.c \
- X VMatMult.c \
- X VMatDet.c \
- X VMatInvert.c \
- X VPrintPoly.c \
- X Vmalloc.c \
- X strdup.c
- X
- XOBJS = \
- X VOpenVp.o \
- X VResizeVp.o \
- X VCloseVp.o \
- X VGetEyeSpace.o \
- X VGetPlanes.o \
- X VReadObject.o \
- X VWriteObject.o \
- X VAllocColor.o \
- X VBindColors.o \
- X VExpBuffer.o \
- X VCrPoly.o \
- X VCrPoints.o \
- X VCopyPoly.o \
- X VDrawPoly.o \
- X VFillPoly.o \
- X VDrawString.o \
- X VClipPoly.o \
- X VDotProd.o \
- X VCrossProd.o \
- X VRotate.o \
- X VTransPoly.o \
- X VWorldToScr.o \
- X VEyeToScr.o \
- X VTrans.o \
- X VIdentMat.o \
- X VMatMult.o \
- X VMatDet.o \
- X VMatInvert.o \
- X VPrintPoly.o \
- X Vmalloc.o \
- X strdup.o
- X
- XNormalLibraryTarget(V,$(OBJS))
- XDependTarget()
- END_OF_FILE
- if test 1148 -ne `wc -c <'acm/V/lib/Imakefile'`; then
- echo shar: \"'acm/V/lib/Imakefile'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/Imakefile'
- fi
- if test -f 'acm/V/lib/VAllocColor.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VAllocColor.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VAllocColor.c'\" \(577 characters\)
- sed "s/^X//" >'acm/V/lib/VAllocColor.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X#include <string.h>
- X
- XVColor *VAllocColor (name)
- Xchar *name; {
- X
- X VColor *p=VColorList, *prev=0, **q;
- X
- X/*
- X * Search for this color among those already allocated.
- X */
- X
- X while (p != (VColor *) 0) {
- X if (strcmp(p->color_name, name) == 0) {
- X return p;
- X }
- X prev = p;
- X p = p->next;
- X }
- X
- X/*
- X * The color was not in the list; allocate a new list element.
- X */
- X
- X if (prev == (VColor *)0)
- X q = &VColorList;
- X else
- X q = &(prev->next);
- X
- X *q = (VColor *) Vmalloc (sizeof(VColor));
- X (*q)->color_name = strdup (name);
- X (*q)->index = -1;
- X (*q)->next = 0;
- X
- X return *q;
- X}
- END_OF_FILE
- if test 577 -ne `wc -c <'acm/V/lib/VAllocColor.c'`; then
- echo shar: \"'acm/V/lib/VAllocColor.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VAllocColor.c'
- fi
- if test -f 'acm/V/lib/VCloseVp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VCloseVp.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VCloseVp.c'\" \(113 characters\)
- sed "s/^X//" >'acm/V/lib/VCloseVp.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VCloseViewport (v)
- XViewport *v; {
- X
- X VDestroyPolygon (v->clipPoly);
- X free ((char *) v);
- X}
- END_OF_FILE
- if test 113 -ne `wc -c <'acm/V/lib/VCloseVp.c'`; then
- echo shar: \"'acm/V/lib/VCloseVp.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VCloseVp.c'
- fi
- if test -f 'acm/V/lib/VCopyPoly.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VCopyPoly.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VCopyPoly.c'\" \(138 characters\)
- sed "s/^X//" >'acm/V/lib/VCopyPoly.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- XVPolygon *VCopyPolygon (poly)
- XVPolygon *poly; {
- X
- X return VCreatePolygon (poly->numVtces, poly->vertex, poly->color);
- X}
- END_OF_FILE
- if test 138 -ne `wc -c <'acm/V/lib/VCopyPoly.c'`; then
- echo shar: \"'acm/V/lib/VCopyPoly.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VCopyPoly.c'
- fi
- if test -f 'acm/V/lib/VCrPoints.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VCrPoints.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VCrPoints.c'\" \(121 characters\)
- sed "s/^X//" >'acm/V/lib/VCrPoints.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- XVPoint *VCreatePoints (numPts)
- Xint numPts; {
- X
- X return (VPoint *) Vmalloc (sizeof(VPoint) * numPts);
- X}
- END_OF_FILE
- if test 121 -ne `wc -c <'acm/V/lib/VCrPoints.c'`; then
- echo shar: \"'acm/V/lib/VCrPoints.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VCrPoints.c'
- fi
- if test -f 'acm/V/lib/VCrPoly.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VCrPoly.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VCrPoly.c'\" \(369 characters\)
- sed "s/^X//" >'acm/V/lib/VCrPoly.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- XVPolygon *VCreatePolygon (numVtces, vert, color)
- Xint numVtces;
- XVPoint *vert;
- XVColor *color; {
- X
- X VPolygon *p;
- X
- X p = (VPolygon *) Vmalloc (sizeof (VPolygon));
- X
- X p->numVtces = numVtces;
- X p->vertex = (VPoint *) Vmalloc (sizeof (VPoint) * numVtces);
- X memcpy ((char *) p->vertex, (char *) vert, sizeof(VPoint) * numVtces);
- X p->color = color;
- X
- X return p;
- X}
- END_OF_FILE
- if test 369 -ne `wc -c <'acm/V/lib/VCrPoly.c'`; then
- echo shar: \"'acm/V/lib/VCrPoly.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VCrPoly.c'
- fi
- if test -f 'acm/V/lib/VCrossProd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VCrossProd.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VCrossProd.c'\" \(174 characters\)
- sed "s/^X//" >'acm/V/lib/VCrossProd.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VCrossProd (a, b, r)
- XVPoint *a, *b, *r; {
- X
- X r->x = a->y * b->z - a->z * b->y;
- X r->y = a->z * b->x - a->x * b->z;
- X r->z = a->x * b->y - a->y * b->x;
- X}
- END_OF_FILE
- if test 174 -ne `wc -c <'acm/V/lib/VCrossProd.c'`; then
- echo shar: \"'acm/V/lib/VCrossProd.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VCrossProd.c'
- fi
- if test -f 'acm/V/lib/VDispObjects.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VDispObjects.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VDispObjects.c'\" \(492 characters\)
- sed "s/^X//" >'acm/V/lib/VDispObjects.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VDisplayObjects() {
- X
- X Point3 TmpPt;
- X int I, J;
- X XPoint xpt[MaxPts];
- X
- X for (I=0; I<NumPolys; ++I) {
- X
- X for (J=0; J<Polygons[I].PolyVtces; ++J) {
- X Transform(&Points[Vertices[Polygons[I].Start + J]], &EyeSpace, &TmpPt);
- X MakeDisplayable(&TmpPt);
- X xpt[J].x = (int) TmpPt.X;
- X xpt[J].y = (int) TmpPt.Y;
- X }
- X/* xpt[J] = xpt[0];
- X XDrawLines (dpy, win, gc, &xpt, J+1, CoordModeOrigin); */
- X XFillPolygon (dpy, win, curGC, &xpt, J, Nonconvex, CoordModeOrigin);
- X }
- X
- X}
- END_OF_FILE
- if test 492 -ne `wc -c <'acm/V/lib/VDispObjects.c'`; then
- echo shar: \"'acm/V/lib/VDispObjects.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VDispObjects.c'
- fi
- if test -f 'acm/V/lib/VDotProd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VDotProd.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VDotProd.c'\" \(111 characters\)
- sed "s/^X//" >'acm/V/lib/VDotProd.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xdouble VDotProd (a, b)
- XVPoint *a, *b; {
- X
- X return a->x * b->x + a->y * b->y + a->z * b->z;
- X}
- END_OF_FILE
- if test 111 -ne `wc -c <'acm/V/lib/VDotProd.c'`; then
- echo shar: \"'acm/V/lib/VDotProd.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VDotProd.c'
- fi
- if test -f 'acm/V/lib/VDrawPoly.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VDrawPoly.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VDrawPoly.c'\" \(763 characters\)
- sed "s/^X//" >'acm/V/lib/VDrawPoly.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VDrawPolygon(v, win, gc, poly)
- XViewport *v;
- XWindow win;
- XGC gc;
- XVPolygon *poly; {
- X
- X VPoint TmpPt, *p;
- X XPoint xpt[VmaxVP];
- X int i;
- X Drawable d;
- X
- X d = (v->flags & VPPixmap) ? (Drawable) v->monoPixmap : (Drawable) win;
- X
- X if (poly == (VPolygon *) NULL)
- X return;
- X
- X for ((i=0, p=poly->vertex); i<poly->numVtces; (++i, ++p)) {
- X if (v->flags & VPPerspective) {
- X TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z;
- X TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z;
- X }
- X else {
- X TmpPt.x = v->Middl.x + v->Scale.x * p->x;
- X TmpPt.y = v->Middl.y - v->Scale.y * p->y;
- X }
- X xpt[i].x = TmpPt.x + 0.5;
- X xpt[i].y = TmpPt.y + 0.5;
- X }
- X
- X if (i > 0) {
- X xpt[i] = xpt[0];
- X XDrawLines (v->dpy, d, gc, xpt, i+1, CoordModeOrigin);
- X }
- X
- X}
- END_OF_FILE
- if test 763 -ne `wc -c <'acm/V/lib/VDrawPoly.c'`; then
- echo shar: \"'acm/V/lib/VDrawPoly.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VDrawPoly.c'
- fi
- if test -f 'acm/V/lib/VDrawString.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VDrawString.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VDrawString.c'\" \(499 characters\)
- sed "s/^X//" >'acm/V/lib/VDrawString.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VDrawString(v, win, gc, p, str, len)
- XViewport *v;
- XWindow win;
- XGC gc;
- XVPoint *p;
- Xchar *str;
- Xint len; {
- X
- X VPoint TmpPt;
- X register int x, y;
- X
- X if (v->flags & VPPerspective) {
- X TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z;
- X TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z;
- X }
- X else {
- X TmpPt.x = v->Middl.x + v->Scale.x * p->x;
- X TmpPt.y = v->Middl.y - v->Scale.y * p->y;
- X }
- X
- X x = TmpPt.x + 0.5;
- X y = TmpPt.y + 0.5;
- X
- X XDrawString (v->dpy, win, gc, x, y, str, len);
- X
- X}
- END_OF_FILE
- if test 499 -ne `wc -c <'acm/V/lib/VDrawString.c'`; then
- echo shar: \"'acm/V/lib/VDrawString.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VDrawString.c'
- fi
- if test -f 'acm/V/lib/VExpBuffer.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VExpBuffer.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VExpBuffer.c'\" \(1455 characters\)
- sed "s/^X//" >'acm/V/lib/VExpBuffer.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VExposeBuffer (v, gc)
- XViewport *v;
- XGC gc; {
- X
- X/*
- X * this is one area where more-than-one window per display gets hairy
- X * -- this call really exposes the drawings buffered in all windows
- X * associated with a given display. the calling sequence needs to be
- X * changed to reflect this.
- X */
- X
- X if (v->flags & VPMono) {
- X XCopyArea (v->dpy, v->monoPixmap, v->win, gc,
- X 0, 0, v->width, v->height, 0, 0);
- X XSetForeground (v->dpy, gc, WhitePixel(v->dpy, v->screen));
- X XFillRectangle (v->dpy, v->monoPixmap, gc, 0, 0, v->width, v->height);
- X XSetForeground (v->dpy, gc, BlackPixel(v->dpy, v->screen));
- X return;
- X }
- X else if (v->flags & VPPixmap) {
- X XCopyArea (v->dpy, v->monoPixmap, v->win, gc,
- X 0, 0, v->width, v->height, 0, 0);
- X return;
- X }
- X
- X if (v->set == 0) {
- X v->set = 1;
- X XStoreColors (v->dpy, v->cmap, v->aColor, v->colors*v->colors);
- X v->pixel = &(v->bPixel[0]);
- X XSetPlaneMask (v->dpy, gc, v->bMask);
- X v->mask = v->bMask;
- X /*
- X for ((p=VColorList, q = &(v->bPixel[1])); p != (VColor *) 0; ++q) {
- X p->xcolor.pixel = *q;
- X p = p->next;
- X }
- X */
- X }
- X else {
- X v->set = 0;
- X XStoreColors (v->dpy, v->cmap, v->bColor, v->colors*v->colors);
- X v->pixel = &(v->aPixel[0]);
- X XSetPlaneMask (v->dpy, gc, v->aMask);
- X v->mask = v->aMask;
- X /*
- X for ((p=VColorList, q = &(v->aPixel[1])); p != (VColor *) 0; ++q) {
- X p->xcolor.pixel = *q;
- X p = p->next;
- X }
- X */
- X }
- X
- X/* XSync (v->dpy, False); */
- X XFlush (v->dpy);
- X}
- END_OF_FILE
- if test 1455 -ne `wc -c <'acm/V/lib/VExpBuffer.c'`; then
- echo shar: \"'acm/V/lib/VExpBuffer.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VExpBuffer.c'
- fi
- if test -f 'acm/V/lib/VEyeToScr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VEyeToScr.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VEyeToScr.c'\" \(551 characters\)
- sed "s/^X//" >'acm/V/lib/VEyeToScr.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- X/*
- X * Transform a 3-D point in the eye space system into viewable
- X * coordinates. The function returns 1 if the x,y information is
- X * displayable (probably displayable, that is).
- X *
- X * VWorldToEye can be used to convert world coordinates to x,y values.
- X */
- X
- Xint VEyeToScreen (v, p, x, y)
- XViewport *v;
- XVPoint *p;
- Xint *x, *y; {
- X
- X register int valid;
- X
- X if (p->z > 0.0) {
- X *x = v->Middl.x + v->Scale.x * p->x / p->z + 0.5;
- X *y = v->Middl.y - v->Scale.y * p->y / p->z + 0.5;
- X valid = 1;
- X }
- X else
- X valid = 0;
- X
- X return valid;
- X}
- END_OF_FILE
- if test 551 -ne `wc -c <'acm/V/lib/VEyeToScr.c'`; then
- echo shar: \"'acm/V/lib/VEyeToScr.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VEyeToScr.c'
- fi
- if test -f 'acm/V/lib/VFillPoly.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VFillPoly.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VFillPoly.c'\" \(1215 characters\)
- sed "s/^X//" >'acm/V/lib/VFillPoly.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- X#define COLLAPSEUNUSEDPOINTS
- X
- Xvoid VFillPolygon(v, win, gc, poly)
- XViewport *v;
- XWindow win;
- XGC gc;
- XVPolygon *poly; {
- X
- X VPoint TmpPt, *p;
- X XPoint xpt[VmaxVP], *lastpt;
- X int i, k;
- X Drawable d;
- X
- X d = (v->flags & VPPixmap) ? (Drawable) v->monoPixmap : (Drawable) win;
- X
- X if (poly == (VPolygon *) NULL)
- X return;
- X
- X k = 0;
- X lastpt = &xpt[0];
- X for ((i=0, p=poly->vertex); i<poly->numVtces; (++i, ++p)) {
- X if (v->flags & VPPerspective) {
- X TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z;
- X TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z;
- X }
- X else {
- X TmpPt.x = v->Middl.x + v->Scale.x * p->x;
- X TmpPt.y = v->Middl.y - v->Scale.y * p->y;
- X }
- X
- X#ifdef COLLAPSEUNUSEDPOINTS
- X xpt[k].x = TmpPt.x + 0.5;
- X xpt[k].y = TmpPt.y + 0.5;
- X
- X if (k == 0 || !(xpt[k].x == lastpt->x && xpt[k].y == lastpt->y))
- X lastpt = &xpt[k++];
- X
- X#else
- X xpt[k].x = TmpPt.x + 0.5;
- X xpt[k].y = TmpPt.y + 0.5;
- X ++k;
- X#endif
- X
- X }
- X
- X if (k > 0) {
- X#ifdef COLLAPSEUNUSEDPOINTS
- X if (k == 1)
- X XDrawPoint (v->dpy, d, gc, xpt[0].x, xpt[0].y);
- X else if (k == 2)
- X XDrawLines (v->dpy, d, gc, xpt, 2, CoordModeOrigin);
- X else
- X#endif
- X XFillPolygon (v->dpy, d, gc, xpt, k, Nonconvex, CoordModeOrigin);
- X }
- X
- X}
- END_OF_FILE
- if test 1215 -ne `wc -c <'acm/V/lib/VFillPoly.c'`; then
- echo shar: \"'acm/V/lib/VFillPoly.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VFillPoly.c'
- fi
- if test -f 'acm/V/lib/VGetPlanes.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VGetPlanes.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VGetPlanes.c'\" \(537 characters\)
- sed "s/^X//" >'acm/V/lib/VGetPlanes.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- XVPolygon *VGetPlanes (poly)
- XVPolygon *poly; {
- X
- X VPoint tmp[64], *p;
- X int i, lasti;
- X
- X lasti = poly->numVtces - 1;
- X p = poly->vertex;
- X
- X for (i=0; i<poly->numVtces; ++i) {
- X tmp[i].x = p->y * poly->vertex[lasti].z - p->z *
- X poly->vertex[lasti].y;
- X tmp[i].y = p->z * poly->vertex[lasti].x - p->x *
- X poly->vertex[lasti].z;
- X tmp[i].z = p->x * poly->vertex[lasti].y - p->y *
- X poly->vertex[lasti].x;
- X lasti = i;
- X p++;
- X }
- X
- X for (i=0; i<poly->numVtces; ++i)
- X poly->vertex[i] = tmp[i];
- X
- X return poly;
- X}
- END_OF_FILE
- if test 537 -ne `wc -c <'acm/V/lib/VGetPlanes.c'`; then
- echo shar: \"'acm/V/lib/VGetPlanes.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VGetPlanes.c'
- fi
- if test -f 'acm/V/lib/VIdentMat.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VIdentMat.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VIdentMat.c'\" \(194 characters\)
- sed "s/^X//" >'acm/V/lib/VIdentMat.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VIdentMatrix (Mtx)
- XVMatrix *Mtx;
- X{
- X short I, J;
- X
- X for (I=0; I<4; ++I)
- X for (J=0; J<4; ++J)
- X if (I == J)
- X (*Mtx).m[I][J] = 1.0;
- X else
- X (*Mtx).m[I][J] = 0.0;
- X
- X}
- END_OF_FILE
- if test 194 -ne `wc -c <'acm/V/lib/VIdentMat.c'`; then
- echo shar: \"'acm/V/lib/VIdentMat.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VIdentMat.c'
- fi
- if test -f 'acm/V/lib/VMatDet.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VMatDet.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VMatDet.c'\" \(564 characters\)
- sed "s/^X//" >'acm/V/lib/VMatDet.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xdouble VMatrixDeterminant(m)
- XVMatrix *m; {
- X
- X double det;
- X
- X det = m->m[0][0] * m->m[1][1] * m->m[2][2] * m->m[3][3] +
- X m->m[1][0] * m->m[2][1] * m->m[3][2] * m->m[0][3] +
- X m->m[2][0] * m->m[3][1] * m->m[0][2] * m->m[1][3] +
- X m->m[3][0] * m->m[0][1] * m->m[1][2] * m->m[2][3] -
- X m->m[0][3] * m->m[1][2] * m->m[2][1] * m->m[3][0] -
- X m->m[1][3] * m->m[2][2] * m->m[3][1] * m->m[0][0] -
- X m->m[2][3] * m->m[3][2] * m->m[0][1] * m->m[1][0] -
- X m->m[3][3] * m->m[0][2] * m->m[1][1] * m->m[2][0];
- X
- X return det;
- X}
- END_OF_FILE
- if test 564 -ne `wc -c <'acm/V/lib/VMatDet.c'`; then
- echo shar: \"'acm/V/lib/VMatDet.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VMatDet.c'
- fi
- if test -f 'acm/V/lib/VMatInvert.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VMatInvert.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VMatInvert.c'\" \(405 characters\)
- sed "s/^X//" >'acm/V/lib/VMatInvert.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- X#define mod(a) (a < 0 ? a + 3 : a % 3)
- X
- XVMatrix *VMatrixInvert(s, d)
- XVMatrix *s;
- XVMatrix *d; {
- X
- X register int i, j;
- X register double det;
- X
- X det = VMatrixDeterminant (s);
- X
- X for (i=0; i<4; ++i)
- X for (j=0; j<4; ++j)
- X d->m[j][i] =(s->m[mod(j+1)][mod(i+1)] *
- X s->m[mod(j+2)][mod(i+2)] -
- X s->m[mod(j-1)][mod(i+1)] *
- X s->m[mod(j-2)][mod(i+2)] ) / det;
- X
- X return d;
- X}
- END_OF_FILE
- if test 405 -ne `wc -c <'acm/V/lib/VMatInvert.c'`; then
- echo shar: \"'acm/V/lib/VMatInvert.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VMatInvert.c'
- fi
- if test -f 'acm/V/lib/VMatMult.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VMatMult.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VMatMult.c'\" \(247 characters\)
- sed "s/^X//" >'acm/V/lib/VMatMult.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VMatrixMult (Mt1, Mt2, R)
- XVMatrix *Mt1, *Mt2, *R; {
- X short I, J, K;
- X
- X for (I=0; I<4; ++I)
- X for (J=0; J<4; ++J) {
- X R->m[I][J] = 0.0;
- X for (K=0; K<4; ++K)
- X R->m[I][J] = R->m[I][J] + Mt1->m[K][J] * Mt2->m[I][K];
- X }
- X}
- END_OF_FILE
- if test 247 -ne `wc -c <'acm/V/lib/VMatMult.c'`; then
- echo shar: \"'acm/V/lib/VMatMult.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VMatMult.c'
- fi
- if test -f 'acm/V/lib/VPrintPoly.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VPrintPoly.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VPrintPoly.c'\" \(455 characters\)
- sed "s/^X//" >'acm/V/lib/VPrintPoly.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VPrintPolygon (file, p)
- XFILE *file;
- XVPolygon *p; {
- X
- X int i;
- X char *nullPoly = "*** Null Polygon ***\n";
- X
- X if (p == (VPolygon *) NULL)
- X fprintf (file, nullPoly);
- X else {
- X if (p->numVtces == 0) {
- X fprintf (file, nullPoly);
- X return;
- X }
- X
- X fprintf (file, "%d vertices:\n", p->numVtces);
- X
- X for (i=0; i<p->numVtces; ++i)
- X fprintf(file, "%9.6g %9.6g %9.6g\n", p->vertex[i].x,
- X p->vertex[i].y, p->vertex[i].z);
- X }
- X
- X return;
- X}
- END_OF_FILE
- if test 455 -ne `wc -c <'acm/V/lib/VPrintPoly.c'`; then
- echo shar: \"'acm/V/lib/VPrintPoly.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VPrintPoly.c'
- fi
- if test -f 'acm/V/lib/VReadObject.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VReadObject.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VReadObject.c'\" \(1079 characters\)
- sed "s/^X//" >'acm/V/lib/VReadObject.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X#include <string.h>
- X
- XVObject *VReadObject(f)
- XFILE *f; {
- X
- X short I, J, vertex, vertices, NumPts, NumPolys;
- X float x, y, z;
- X char str[64], name[128];
- X VPoint *tmpPts, pts[VmaxVP];
- X VPolygon **polygons;
- X VObject *object;
- X
- X fscanf(f, "%s\n", name);
- X fscanf(f, "%hd", &NumPts);
- X fscanf(f, "%hd", &NumPolys);
- X
- X tmpPts = (VPoint *) Vmalloc (NumPts * sizeof(VPoint));
- X polygons = (VPolygon **) Vmalloc (NumPolys * sizeof(VPolygon *));
- X
- X for (I=0; I<NumPts; ++I) {
- X fscanf(f, "%hd", &J);
- X fscanf(f, "%f", &x);
- X fscanf(f, "%f", &y);
- X fscanf(f, "%f", &z);
- X tmpPts[I].x = x;
- X tmpPts[I].y = y;
- X tmpPts[I].z = z;
- X }
- X
- X for (I=0; I<NumPolys; ++I) {
- X fscanf(f, "%s %hd", str, &(vertices));
- X for (J=0; J<vertices; ++J) {
- X fscanf(f, "%hd", &(vertex));
- X pts[J] = tmpPts[vertex - 1];
- X }
- X polygons[I] = VCreatePolygon (vertices, pts, VAllocColor(str));
- X }
- X
- X object = (VObject *) Vmalloc (sizeof(VObject));
- X object->name = strdup (name);
- X object->numPolys = NumPolys;
- X object->polygon = polygons;
- X
- X free ((char *) tmpPts);
- X return ferror(f) ? (VObject *) 0 : object;
- X}
- END_OF_FILE
- if test 1079 -ne `wc -c <'acm/V/lib/VReadObject.c'`; then
- echo shar: \"'acm/V/lib/VReadObject.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VReadObject.c'
- fi
- if test -f 'acm/V/lib/VResizeVp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VResizeVp.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VResizeVp.c'\" \(1518 characters\)
- sed "s/^X//" >'acm/V/lib/VResizeVp.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xvoid VResizeViewport (v, unit, dist, scale, width, height)
- XViewport *v;
- Xdouble unit;
- Xdouble dist;
- Xdouble scale;
- Xint width;
- Xint height; {
- X
- X VPoint clip[4];
- X
- X/*
- X * Allocate a new monochrome bitmap to buffer the displayed image.
- X */
- X
- X if (v->flags & VPPixmap) {
- X XFreePixmap (v->dpy, v->monoPixmap);
- X v->monoPixmap = XCreatePixmap (v->dpy,
- X RootWindow(v->dpy, v->screen), v->width, v->height,
- X DisplayPlanes (v->dpy, v->screen));
- X }
- X
- X/*
- X * Calculate screen resolution in pixels per unit.
- X */
- X
- X v->dist = dist;
- X v->units = unit;
- X
- X/*
- X * Use that info to set scaling factors.
- X */
- X
- X v->Scale.x = v->xres * dist * scale;
- X v->Scale.y = v->yres * dist * scale;
- X v->Scale.z = 1.0;
- X
- X v->Middl.x = (double) width / 2.0;
- X v->Middl.y = (double) height / 2.0;
- X v->Middl.z = 0.0;
- X
- X/*
- X * Build the clipping planes for our view into the eye space.
- X */
- X
- X clip[0].x = - width / v->xres / 2.0 / scale;
- X clip[0].y = - height / v->yres / 2.0 / scale;
- X clip[0].z = dist;
- X clip[1].x = - width / v->xres / 2.0 / scale;
- X clip[1].y = height / v->yres / 2.0 / scale;
- X clip[1].z = dist;
- X clip[2].x = width / v->xres / 2.0 / scale;
- X clip[2].y = height / v->yres / 2.0 / scale;
- X clip[2].z = dist;
- X clip[3].x = width / v->xres / 2.0 / scale;
- X clip[3].y = - height / v->yres / 2.0 / scale;
- X clip[3].z = dist;
- X
- X v->clipPoly = VCreatePolygon (4, clip);
- X VGetPlanes (v->clipPoly);
- X}
- END_OF_FILE
- if test 1518 -ne `wc -c <'acm/V/lib/VResizeVp.c'`; then
- echo shar: \"'acm/V/lib/VResizeVp.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VResizeVp.c'
- fi
- if test -f 'acm/V/lib/VRotate.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VRotate.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VRotate.c'\" \(961 characters\)
- sed "s/^X//" >'acm/V/lib/VRotate.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X#include <math.h>
- X
- XVMatrix *VRotate (Mt1, operation, angle)
- XVMatrix * Mt1;
- Xint operation;
- Xdouble angle; {
- X
- X VMatrix m, s;
- X
- X VIdentMatrix (&m);
- X
- X switch (operation) {
- X case XRotation:
- X m.m[1][1] = m.m[2][2] = cos(angle);
- X m.m[2][1] = sin(angle);
- X m.m[1][2] = - m.m[2][1];
- X break;
- X case YRotation:
- X m.m[0][0] = m.m[2][2] = cos(angle);
- X m.m[2][0] = sin(angle);
- X m.m[0][2] = - m.m[2][0];
- X break;
- X case ZRotation:
- X m.m[0][0] = m.m[1][1] = cos(angle);
- X m.m[1][0] = sin(angle);
- X m.m[0][1] = - m.m[1][0];
- X break;
- X }
- X
- X s = *Mt1;
- X
- X VMatrixMult (&s, &m, Mt1);
- X return Mt1;
- X}
- X
- XVMatrix *VTranslatePoint (Mt, loc)
- XVMatrix *Mt;
- XVPoint loc; {
- X
- X Mt->m[0][3] = Mt->m[0][3] + loc.x;
- X Mt->m[1][3] = Mt->m[1][3] + loc.y;
- X Mt->m[2][3] = Mt->m[2][3] + loc.z;
- X return Mt;
- X
- X}
- X
- XVMatrix *VTranslate (Mt, x, y ,z)
- XVMatrix *Mt;
- Xdouble x, y, z; {
- X
- X Mt->m[0][3] = Mt->m[0][3] + x;
- X Mt->m[1][3] = Mt->m[1][3] + y;
- X Mt->m[2][3] = Mt->m[2][3] + z;
- X return Mt;
- X}
- END_OF_FILE
- if test 961 -ne `wc -c <'acm/V/lib/VRotate.c'`; then
- echo shar: \"'acm/V/lib/VRotate.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VRotate.c'
- fi
- if test -f 'acm/V/lib/VTrans.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VTrans.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VTrans.c'\" \(464 characters\)
- sed "s/^X//" >'acm/V/lib/VTrans.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- X/*
- X * VTransform: transform a point from one coordinate system to another.
- X */
- X
- Xvoid VTransform (pt, mt, newPt)
- XVPoint *pt;
- XVMatrix *mt;
- XVPoint *newPt; {
- X
- X newPt->x = pt->x * mt->m[0][0] + pt->y * mt->m[0][1]
- X + pt->z * mt->m[0][2] + mt->m[0][3];
- X
- X newPt->y = pt->x * mt->m[1][0] + pt->y * mt->m[1][1]
- X + pt->z * mt->m[1][2] + mt->m[1][3];
- X
- X newPt->z = pt->x * mt->m[2][0] + pt->y * mt->m[2][1]
- X + pt->z * mt->m[2][2] + mt->m[2][3];
- X}
- END_OF_FILE
- if test 464 -ne `wc -c <'acm/V/lib/VTrans.c'`; then
- echo shar: \"'acm/V/lib/VTrans.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VTrans.c'
- fi
- if test -f 'acm/V/lib/VTransPoly.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VTransPoly.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VTransPoly.c'\" \(235 characters\)
- sed "s/^X//" >'acm/V/lib/VTransPoly.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- XVPolygon *VTransformPolygon (poly, m)
- XVPolygon *poly;
- XVMatrix *m; {
- X
- X int i;
- X VPoint tmp;
- X
- X for (i=0; i<poly->numVtces; ++i) {
- X VTransform (&(poly->vertex[i]), m, &tmp);
- X poly->vertex[i] = tmp;
- X }
- X
- X return poly;
- X}
- END_OF_FILE
- if test 235 -ne `wc -c <'acm/V/lib/VTransPoly.c'`; then
- echo shar: \"'acm/V/lib/VTransPoly.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VTransPoly.c'
- fi
- if test -f 'acm/V/lib/VWorldToScr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VWorldToScr.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VWorldToScr.c'\" \(375 characters\)
- sed "s/^X//" >'acm/V/lib/VWorldToScr.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- X/*
- X * Transform a 3-D point in the world system into viewable
- X * coordinates. The function returns 1 if the x,y information is
- X * displayable (probably displayable, that is).
- X */
- X
- Xint VWorldToScreen (v, p, x, y)
- XViewport *v;
- XVPoint *p;
- Xint *x, *y; {
- X
- X VPoint eyept;
- X
- X VTransform (p, &(v->eyeSpace), &eyept);
- X return VEyeToScreen (v, &eyept, x, y);
- X}
- END_OF_FILE
- if test 375 -ne `wc -c <'acm/V/lib/VWorldToScr.c'`; then
- echo shar: \"'acm/V/lib/VWorldToScr.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VWorldToScr.c'
- fi
- if test -f 'acm/V/lib/VWriteObject.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/VWriteObject.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/VWriteObject.c'\" \(914 characters\)
- sed "s/^X//" >'acm/V/lib/VWriteObject.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X#include <string.h>
- X
- Xint VWriteObject(f, obj)
- XFILE *f;
- XVObject *obj; {
- X
- X int i, j, k, points;
- X VPolygon **q;
- X VPoint *p;
- X
- X/*
- X * Total the number of vertices in all of the object's polygons
- X */
- X
- X points = 0;
- X q = obj->polygon;
- X for (i=0; i<obj->numPolys; ++i) {
- X points += q[i]->numVtces;
- X }
- X
- X/*
- X * Print the header
- X */
- X
- X fprintf (f, "%s\n%d %d\n", obj->name, points, obj->numPolys);
- X
- X/*
- X * Print the point list
- X */
- X
- X k = 1;
- X q = obj->polygon;
- X for (i=0; i<obj->numPolys; ++i) {
- X for ((j=0, p=q[i]->vertex); j<q[i]->numVtces; (++p, ++j)) {
- X fprintf(f, "%d %g %g %g\n", k, p->x, p->y, p->z);
- X ++k;
- X }
- X }
- X
- X/*
- X * Print the polygon list
- X */
- X
- X k = 1;
- X q = obj->polygon;
- X for (i=0; i<obj->numPolys; ++i) {
- X fprintf(f, "%s %d", q[i]->color->color_name, q[i]->numVtces);
- X for (j=0; j<q[i]->numVtces; ++j)
- X fprintf(f, " %d", k++);
- X fprintf (f, "\n");
- X }
- X
- X return ferror(f) ? -1 : 0;
- X}
- END_OF_FILE
- if test 914 -ne `wc -c <'acm/V/lib/VWriteObject.c'`; then
- echo shar: \"'acm/V/lib/VWriteObject.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/VWriteObject.c'
- fi
- if test -f 'acm/V/lib/Vmalloc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/Vmalloc.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/Vmalloc.c'\" \(299 characters\)
- sed "s/^X//" >'acm/V/lib/Vmalloc.c' <<'END_OF_FILE'
- X#include "Vlib.h"
- X
- Xextern char * malloc();
- X
- Xchar *Vmalloc(size)
- Xint size; {
- X
- X char *p;
- X
- X if ((p = malloc(size)) == (char *) NULL) {
- X fprintf (stderr, "V package memory allocation error.\n");
- X fprintf (stderr, "An error was encountered allocating\
- X %d bytes.\n", size);
- X exit (1);
- X }
- X return p;
- X}
- END_OF_FILE
- if test 299 -ne `wc -c <'acm/V/lib/Vmalloc.c'`; then
- echo shar: \"'acm/V/lib/Vmalloc.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/Vmalloc.c'
- fi
- if test -f 'acm/V/lib/strdup.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/lib/strdup.c'\"
- else
- echo shar: Extracting \"'acm/V/lib/strdup.c'\" \(180 characters\)
- sed "s/^X//" >'acm/V/lib/strdup.c' <<'END_OF_FILE'
- X#include <string.h>
- X#include "Vlib.h"
- X
- X#ifndef SYSV
- X
- Xchar *strdup(string)
- Xchar *string;
- X{
- X return(strcpy(Vmalloc(sizeof(char) * (strlen(string) + 1)),
- X string));
- X}
- X
- X#endif
- END_OF_FILE
- if test 180 -ne `wc -c <'acm/V/lib/strdup.c'`; then
- echo shar: \"'acm/V/lib/strdup.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/lib/strdup.c'
- fi
- if test ! -d 'acm/V/test' ; then
- echo shar: Creating directory \"'acm/V/test'\"
- mkdir 'acm/V/test'
- fi
- if test -f 'acm/V/test/Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/test/Imakefile'\"
- else
- echo shar: Extracting \"'acm/V/test/Imakefile'\" \(144 characters\)
- sed "s/^X//" >'acm/V/test/Imakefile' <<'END_OF_FILE'
- X#include "../../acm.def"
- X
- XSRCS= animate.c app.c
- XOBJS= animate.o app.o
- XSYS_LIBRARIES= -L../lib -lV -lm -lX11
- X
- XComplexProgramTarget(animate)
- END_OF_FILE
- if test 144 -ne `wc -c <'acm/V/test/Imakefile'`; then
- echo shar: \"'acm/V/test/Imakefile'\" unpacked with wrong size!
- fi
- # end of 'acm/V/test/Imakefile'
- fi
- if test -f 'acm/V/test/fixf16.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/test/fixf16.c'\"
- else
- echo shar: Extracting \"'acm/V/test/fixf16.c'\" \(801 characters\)
- sed "s/^X//" >'acm/V/test/fixf16.c' <<'END_OF_FILE'
- X#include "../lib/Vlib.h"
- X
- Xmain () {
- X
- X int i, k;
- X VObject *obj;
- X VPolygon **poly;
- X VPoint *q, tmp;
- X VMatrix mtx;
- X
- X if ((obj = VReadObject(stdin)) == (VObject *) NULL) {
- X fprintf (stderr, "Error reading the object definition.\n");
- X exit (1);
- X }
- X
- X/*
- X * Prepare a transformation matrix that:
- X * (a) swaps X and Y coordinates.
- X * (b) negates Z coordinate.
- X */
- X
- X VIdentMatrix (&mtx);
- X mtx.m[0][0] = 0.0;
- X mtx.m[0][1] = 1.0;
- X mtx.m[1][0] = 1.0;
- X mtx.m[1][1] = 0.0;
- X mtx.m[2][2] = -1.0;
- X
- X poly = obj->polygon;
- X
- X for (i=0; i<obj->numPolys; ++i) {
- X for ((k=0, q=poly[i]->vertex); k<poly[i]->numVtces; (++k, ++q)) {
- X VTransform(q, &mtx, &tmp);
- X *q = tmp;
- X }
- X }
- X
- X VWriteObject (stdout, obj);
- X}
- END_OF_FILE
- if test 801 -ne `wc -c <'acm/V/test/fixf16.c'`; then
- echo shar: \"'acm/V/test/fixf16.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/test/fixf16.c'
- fi
- if test -f 'acm/V/test/fixmig.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/V/test/fixmig.c'\"
- else
- echo shar: Extracting \"'acm/V/test/fixmig.c'\" \(795 characters\)
- sed "s/^X//" >'acm/V/test/fixmig.c' <<'END_OF_FILE'
- X#include "../lib/Vlib.h"
- X
- Xmain () {
- X
- X int i, k;
- X VObject *obj;
- X VPolygon **poly;
- X VPoint *q, tmp;
- X VMatrix mtx;
- X
- X if ((obj = VReadObject(stdin)) == (VObject *) NULL) {
- X fprintf (stderr, "Error reading the object definition.\n");
- X exit (1);
- X }
- X
- X/*
- X * Prepare a transformation matrix that:
- X * (a) swaps X and Y coordinates.
- X * (b) negates Z coordinate.
- X */
- X
- X VIdentMatrix (&mtx);
- X mtx.m[0][3] = 39.60232;
- X mtx.m[0][0] = -2.1523;
- X mtx.m[1][1] = 2.1523;
- X mtx.m[2][2] = 2.1523;
- X
- X poly = obj->polygon;
- X
- X for (i=0; i<obj->numPolys; ++i) {
- X for ((k=0, q=poly[i]->vertex); k<poly[i]->numVtces; (++k, ++q)) {
- X VTransform(q, &mtx, &tmp);
- X *q = tmp;
- X }
- X }
- X
- X VWriteObject (stdout, obj);
- X}
- END_OF_FILE
- if test 795 -ne `wc -c <'acm/V/test/fixmig.c'`; then
- echo shar: \"'acm/V/test/fixmig.c'\" unpacked with wrong size!
- fi
- # end of 'acm/V/test/fixmig.c'
- fi
- if test -f 'acm/acm.def' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/acm.def'\"
- else
- echo shar: Extracting \"'acm/acm.def'\" \(534 characters\)
- sed "s/^X//" >'acm/acm.def' <<'END_OF_FILE'
- X/*
- X * I run imake all without all the other X11Rx stuff on my system.
- X *
- X * To facilitate this, I override a few imake parameters.
- X *
- X * To make the changes I invoke imake this way:
- X *
- X * % imake -DStandAloneImake ...
- X *
- X * If you use this, you will surely want to modify some of these
- X * paths.
- X */
- X
- X#ifdef StandAloneImake
- XTOP = .
- XIMAKE = /people/riley/bin/imake
- XIRULESRC = /usr/lib/local/imake.includes
- XIMAKE_DEFINES = -DStandAloneImake
- XIMAKE_CMD = $(IMAKE) -s Makefile $(IMAKE_DEFINES)
- X#endif
- X
- XCDEBUGFLAGS = -systype bsd43 -O
- END_OF_FILE
- if test 534 -ne `wc -c <'acm/acm.def'`; then
- echo shar: \"'acm/acm.def'\" unpacked with wrong size!
- fi
- # end of 'acm/acm.def'
- fi
- if test ! -d 'acm/fsim' ; then
- echo shar: Creating directory \"'acm/fsim'\"
- mkdir 'acm/fsim'
- fi
- if test -f 'acm/fsim/V2tgif.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/V2tgif.c'\"
- else
- echo shar: Extracting \"'acm/fsim/V2tgif.c'\" \(1441 characters\)
- sed "s/^X//" >'acm/fsim/V2tgif.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include <Vlib.h>
- X
- X#define INCHES 128
- X
- Xint horg = 4 * INCHES;
- Xint vorg = 5 * INCHES;
- Xdouble scale = ((double) INCHES / 4.0); /* 4 feet to the inch */
- X
- X#define XAXIS 1
- X#define YAXIS 2
- X#define ZAXIS 3
- Xint axis = XAXIS;
- X
- Xextern char * optarg;
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[]; {
- X
- X VObject *object;
- X char *name;
- X FILE *f;
- X int c, i, j, k, n;
- X int v, h;
- X VPoint *q, tmp;
- X VMatrix mtx;
- X VPolygon **p;
- X
- X while ((c = getopt (argc, argv, "f:xyz")) != EOF) {
- X
- X switch (c) {
- X
- X case 'f':
- X name = optarg;
- X break;
- X
- X case 'x':
- X axis = XAXIS;
- X break;
- X
- X case 'y':
- X axis = YAXIS;
- X break;
- X
- X case 'z':
- X axis = ZAXIS;
- X break;
- X }
- X }
- X
- X f = fopen (name, "r");
- X object = VReadObject(f);
- X fclose (f);
- X
- X printf ("state(0,6,0,0,0,16,1,4,1,1,0,0,1,0,1,0,1,0,4).\n");
- X
- X n = object->numPolys;
- X p = object->polygon;
- X for (i=0; i<n; ++i) {
- X printf ("polygon(yellow,%d,[", p[i]->numVtces+1);
- X for ((k=0, q=p[i]->vertex); k<p[i]->numVtces; (++k, ++q)) {
- X transform (q, &v, &h);
- X printf ("%d,%d,", v, h);
- X }
- X transform (p[i]->vertex, &v, &h);
- X printf ("%d,%d],0,0,1,0).\n", v, h);
- X ++j;
- X }
- X
- X exit (0);
- X}
- X
- Xtransform (p, y, x)
- XVPoint *p;
- Xint *y, *x; {
- X
- X double dx, dy;
- X
- X if (axis == XAXIS) {
- X dx = p->y;
- X dy = p->z;
- X }
- X else if (axis == YAXIS) {
- X dx = p->x;
- X dy = p->z;
- X }
- X else if (axis == ZAXIS) {
- X dx = p->x;
- X dy = p->y;
- X }
- X
- X *x = (int) (dx * scale + 0.5) + vorg;
- X *y = (int) (dy * scale + 0.5) + horg;
- X}
- X
- END_OF_FILE
- if test 1441 -ne `wc -c <'acm/fsim/V2tgif.c'`; then
- echo shar: \"'acm/fsim/V2tgif.c'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/V2tgif.c'
- fi
- if test -f 'acm/fsim/aim-9' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/aim-9'\"
- else
- echo shar: Extracting \"'acm/fsim/aim-9'\" \(1345 characters\)
- sed "s/^X//" >'acm/fsim/aim-9' <<'END_OF_FILE'
- X#
- X66 5
- X1 -0.9167 0 0
- X2 -0.9167 0.0833 0
- X3 -1 0.1667 0
- X4 -1.6667 0.25 0
- X5 -1.8333 0.25 0
- X6 -2.3333 0.8333 0
- X7 -2.4167 1 0
- X8 -2.4167 0.25 0
- X9 -7.5833 0.25 0
- X10 -8 1 0
- X11 -9 1 0
- X12 -9 -1 0
- X13 -8 -1 0
- X14 -7.5833 -0.25 0
- X15 -2.4167 -0.25 0
- X16 -2.4167 -1 0
- X17 -2.3333 -0.8333 0
- X18 -1.8333 -0.25 0
- X19 -1.6667 -0.25 0
- X20 -1 -0.1667 0
- X21 -0.9167 -0.0833 0
- X1 -0.9167 0 0
- X2 -0.9167 0 0.0833
- X3 -1 0 0.1667
- X4 -1.6667 0 0.25
- X5 -1.8333 0 0.25
- X6 -2.3333 0 0.8333
- X7 -2.4167 0 1
- X8 -2.4167 0 0.25
- X9 -7.5833 0 0.25
- X10 -8 0 1
- X11 -9 0 1
- X12 -9 0 -1
- X13 -8 0 -1
- X14 -7.5833 0 -0.25
- X15 -2.4167 0 -0.25
- X16 -2.4167 0 -1
- X17 -2.3333 0 -0.8333
- X18 -1.8333 0 -0.25
- X19 -1.6667 0 -0.25
- X20 -1 0 -0.1667
- X21 -0.9167 0 -0.0833
- X43 -9 0.25 0
- X44 -9 0.1768 0.1768
- X45 -9 0 0.25
- X46 -9 -0.1768 0.1768
- X47 -9 -0.25 0
- X48 -9 -0.1768 -0.1768
- X49 -9 0 -0.25
- X50 -9 0.1768 -0.1768
- X51 -9 -0.25 0
- X52 -9.75 -0.5 0
- X53 -12 -0.75 0
- X54 -13.5 -0.75 0
- X55 -12.75 -0.5 0
- X56 -15.25 -0.5 0
- X57 -19.9167 0 0
- X58 -15.0833 0.4167 0
- X59 -15.75 0.5 0
- X60 -12.5833 0.6667 0
- X61 -12.0833 0.5833 0
- X62 -9.833 0.5 0
- X63 -9 0.25 0
- X64 -12.5833 0 0.6667
- X65 -12.5833 -0.6667 0
- X66 -12.5833 0 -0.6667
- Xwhite 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
- Xwhite 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
- Xwhite 8 43 44 45 46 47 48 49 50
- Xwhite 13 51 52 53 54 55 56 57 58 59 60 61 62 63
- Xwhite 4 60 64 65 66
- END_OF_FILE
- if test 1345 -ne `wc -c <'acm/fsim/aim-9'`; then
- echo shar: \"'acm/fsim/aim-9'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/aim-9'
- fi
- if test -f 'acm/fsim/bullet' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/bullet'\"
- else
- echo shar: Extracting \"'acm/fsim/bullet'\" \(130 characters\)
- sed "s/^X//" >'acm/fsim/bullet' <<'END_OF_FILE'
- X*a-bullet
- X6 3
- X1 0 0 0
- X2 -0.4 0.5 0
- X3 -25.0 0 0
- X4 -0.4 -0.5 0
- X5 -0.4 0 0.5
- X6 -0.4 0 -0.5
- Xred 4 1 2 3 4
- Xred 4 1 5 3 6
- Xred 4 2 5 4 6
- END_OF_FILE
- if test 130 -ne `wc -c <'acm/fsim/bullet'`; then
- echo shar: \"'acm/fsim/bullet'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/bullet'
- fi
- if test -f 'acm/fsim/damage.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/damage.h'\"
- else
- echo shar: Extracting \"'acm/fsim/damage.h'\" \(960 characters\)
- sed "s/^X//" >'acm/fsim/damage.h' <<'END_OF_FILE'
- X#define isFunctioning(c, sys) ((c->damageBits & sys) ? 1 : 0)
- X
- X/*
- X * Each of these bits are true if the corresponding system is
- X * functioning.
- X */
- X
- X#define SYS_RADAR 0x0001 /* set if radar works */
- X#define SYS_TEWS 0x0002 /* set if TEWS works */
- X#define SYS_FLAPS 0x0004 /* set if flaps work */
- X#define SYS_SPEEDBRAKE 0x0008
- X#define SYS_HYD1 0x0010
- X#define SYS_HYD2 0x0020
- X#define SYS_GEN1 0x0040
- X#define SYS_GEN2 0x0080
- X#define SYS_ENGINE1 0x0100 /* set if engine #1 works */
- X#define SYS_ENGINE2 0x0200 /* set if engine #2 works */
- X#define SYS_HUD 0x0400 /* set if HUD works */
- X#define SYS_FUEL 0x0800 /* set if there isn't a fuel leak */
- X#define SYS_NOSEGEAR 0x1000
- X#define SYS_LEFTMAIN 0x2000
- X#define SYS_RIGHTMAIN 0x4000
- X#define SYS_NODAMAGE 0x7fff
- X
- X#define FLAG_LOWFUEL 0x8000 /* set when fuel < 1000 lbs */
- X#define FLAG_SPEEDBRAKE 0x10000 /* set when speedbrake is deployed */
- X#define FLAG_WHEELBRAKE 0x20000 /* set when wheel brakes are applied */
- X
- END_OF_FILE
- if test 960 -ne `wc -c <'acm/fsim/damage.h'`; then
- echo shar: \"'acm/fsim/damage.h'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/damage.h'
- fi
- if test -f 'acm/fsim/droneCalc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/droneCalc.c'\"
- else
- echo shar: Extracting \"'acm/fsim/droneCalc.c'\" \(676 characters\)
- sed "s/^X//" >'acm/fsim/droneCalc.c' <<'END_OF_FILE'
- X/*
- X * xflight : an aerial combat simulator for X
- X *
- X * Written by Riley Rainey, riley@mips.com
- X *
- X * Permission to use, copy, modify and distribute (without charge) this
- X * software, documentation, images, etc. is granted, provided that this
- X * comment and the author's name is retained.
- X *
- X */
- X
- X#include "pm.h"
- X
- X/*
- X * Drone flight management
- X */
- X
- Xint droneCalculations (c)
- Xcraft *c; {
- X
- X c->prevSg = c->Sg;
- X
- X c->Sg.x += c->Cg.x * deltaT;
- X c->Sg.y += c->Cg.y * deltaT;
- X c->Sg.z += c->Cg.z * deltaT;
- X
- X/*
- X * Don't let drones get above 60 thousand feet
- X */
- X
- X if (c->Sg.z < -60000.0)
- X return 1;
- X
- X/*
- X * Drone crash detection
- X */
- X
- X if (c->Sg.z > 0.0)
- X return 1;
- X
- X return 0;
- X}
- END_OF_FILE
- if test 676 -ne `wc -c <'acm/fsim/droneCalc.c'`; then
- echo shar: \"'acm/fsim/droneCalc.c'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/droneCalc.c'
- fi
- if test -f 'acm/fsim/flaps0.xbm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/flaps0.xbm'\"
- else
- echo shar: Extracting \"'acm/fsim/flaps0.xbm'\" \(1729 characters\)
- sed "s/^X//" >'acm/fsim/flaps0.xbm' <<'END_OF_FILE'
- X#define flaps0_width 64
- X#define flaps0_height 32
- X#define flaps0_x_hot 4
- X#define flaps0_y_hot 25
- Xstatic char flaps0_bits[] = {
- X 0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0xdf, 0xdd, 0xfd,
- X 0x1f, 0x00, 0x00, 0x00, 0x60, 0xef, 0xee, 0xee, 0xee, 0x1f, 0x00, 0x00,
- X 0x70, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x03, 0x00, 0x50, 0xbb, 0xbb, 0xbb,
- X 0xbb, 0x7b, 0x7f, 0x00, 0x50, 0xdf, 0xdd, 0xdd, 0xdd, 0xbd, 0xff, 0x07,
- X 0xe0, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00};
- END_OF_FILE
- if test 1729 -ne `wc -c <'acm/fsim/flaps0.xbm'`; then
- echo shar: \"'acm/fsim/flaps0.xbm'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/flaps0.xbm'
- fi
- if test -f 'acm/fsim/flaps2.xbm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/flaps2.xbm'\"
- else
- echo shar: Extracting \"'acm/fsim/flaps2.xbm'\" \(1730 characters\)
- sed "s/^X//" >'acm/fsim/flaps2.xbm' <<'END_OF_FILE'
- X#define flaps2_width 64
- X#define flaps2_height 32
- X#define flaps2_x_hot -1
- X#define flaps2_y_hot -1
- Xstatic char flaps2_bits[] = {
- X 0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xdd, 0xfd,
- X 0x1f, 0x00, 0x00, 0x00, 0x20, 0xef, 0xee, 0xee, 0xee, 0xff, 0x03, 0x00,
- X 0x30, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x3f, 0x00, 0x38, 0xbb, 0xbb, 0xbb,
- X 0xbb, 0x7b, 0x00, 0x00, 0x28, 0xdf, 0xdd, 0xdd, 0xdd, 0x3d, 0x0e, 0x00,
- X 0x6c, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1e, 0x00, 0x3c, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x3c, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00};
- END_OF_FILE
- if test 1730 -ne `wc -c <'acm/fsim/flaps2.xbm'`; then
- echo shar: \"'acm/fsim/flaps2.xbm'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/flaps2.xbm'
- fi
- if test -f 'acm/fsim/flaps3.xbm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/flaps3.xbm'\"
- else
- echo shar: Extracting \"'acm/fsim/flaps3.xbm'\" \(1730 characters\)
- sed "s/^X//" >'acm/fsim/flaps3.xbm' <<'END_OF_FILE'
- X#define flaps3_width 64
- X#define flaps3_height 32
- X#define flaps3_x_hot -1
- X#define flaps3_y_hot -1
- Xstatic char flaps3_bits[] = {
- X 0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xdd, 0xfd,
- X 0x1f, 0x00, 0x00, 0x00, 0x20, 0xef, 0xee, 0xee, 0xee, 0xff, 0x03, 0x00,
- X 0x30, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x3f, 0x00, 0x38, 0xbb, 0xbb, 0xbb,
- X 0xbb, 0x7b, 0x00, 0x00, 0x28, 0xdf, 0xdd, 0xdd, 0xdd, 0x3d, 0x0c, 0x00,
- X 0x6c, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x38, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00};
- END_OF_FILE
- if test 1730 -ne `wc -c <'acm/fsim/flaps3.xbm'`; then
- echo shar: \"'acm/fsim/flaps3.xbm'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/flaps3.xbm'
- fi
- if test -f 'acm/fsim/getStick.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/getStick.c'\"
- else
- echo shar: Extracting \"'acm/fsim/getStick.c'\" \(1272 characters\)
- sed "s/^X//" >'acm/fsim/getStick.c' <<'END_OF_FILE'
- X/*
- X * xflight : an aerial combat simulator for X
- X *
- X * Written by Riley Rainey, riley@mips.com
- X *
- X * Permission to use, copy, modify and distribute (without charge) this
- X * software, documentation, images, etc. is granted, provided that this
- X * comment and the author's name is retained.
- X *
- X */
- X
- X#include "pm.h"
- X#include <math.h>
- X
- X/*
- X * getStick : get stick input from mouse
- X * inputs Sa and Se range from -1.0 to 1.0.
- X */
- X
- Xint getStick (c, u)
- Xcraft *c;
- Xviewer *u; {
- X
- X int rootX, rootY, x, y;
- X Window root, child;
- X unsigned int mask;
- X double d, fuzz;
- X
- X if (XQueryPointer (u->dpy, u->win, &root, &child, &rootX, &rootY,
- X &x, &y, &mask) == True) {
- X
- X if (x >= 0 && y >= 0 && x < u->width && y < u->height) {
- X
- X fuzz = u->scaleFactor * 20.0;
- X x = x - u->xCenter;
- X y = y - u->yCenter;
- X d = sqrt ((double)(x*x + y*y));
- X
- X if (d > fuzz) {
- X c->Sa=(double) x / (double) u->xCenter * (d-fuzz) / d;
- X c->Se=(double) y / (double) u->yCenter * (d-fuzz) / d;
- X#ifndef LINEAR_CONTROL_RESPONSE
- X if (c->Sa < 0.0)
- X c->Sa = - c->Sa * c->Sa;
- X else
- X c->Sa = c->Sa * c->Sa;
- X
- X if (c->Se < 0.0)
- X c->Se = - c->Se * c->Se;
- X else
- X c->Se = c->Se * c->Se;
- X#endif
- X }
- X else {
- X c->Sa = 0.0;
- X c->Se = 0.0;
- X }
- X return 1;
- X
- X }
- X }
- X
- X return 0;
- X}
- END_OF_FILE
- if test 1272 -ne `wc -c <'acm/fsim/getStick.c'`; then
- echo shar: \"'acm/fsim/getStick.c'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/getStick.c'
- fi
- if test -f 'acm/fsim/header' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/header'\"
- else
- echo shar: Extracting \"'acm/fsim/header'\" \(297 characters\)
- sed "s/^X//" >'acm/fsim/header' <<'END_OF_FILE'
- X/*
- X * xflight : an aerial combat simulator for X
- X *
- X * Written by Riley Rainey, riley@mips.com
- X *
- X * Permission to use, copy, modify and distribute (without charge) this
- X * software, documentation, images, etc. is granted, provided that this
- X * comment and the author's name is retained.
- X *
- X */
- END_OF_FILE
- if test 297 -ne `wc -c <'acm/fsim/header'`; then
- echo shar: \"'acm/fsim/header'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/header'
- fi
- if test -f 'acm/fsim/manifest.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/manifest.h'\"
- else
- echo shar: Extracting \"'acm/fsim/manifest.h'\" \(1193 characters\)
- sed "s/^X//" >'acm/fsim/manifest.h' <<'END_OF_FILE'
- X/*
- X * UPDATE_INTERVAL define the number of microseconds between
- X * each position update when the game is running.
- X */
- X
- X#define UPDATE_INTERVAL 125000
- X
- X/*
- X * REDRAW_EVERY defines the number of update intervals between each
- X * redraw of player screens.
- X */
- X
- X#define REDRAW_EVERY 3
- X
- X/*
- X * ACM_PORT define the internet port number to be used in the game
- X * startup handshaking.
- X */
- X
- X#define ACM_PORT 3232
- X
- X/*
- X * ACM becomes the name used to lookup X resources on a particular
- X * X server.
- X */
- X
- X#define ACM "acm"
- X
- X/*
- X * Animation on multi-plane displays can be performed with pixmaps or by
- X * manipulating planes and colors. If USE_PIXMAP_ANIMATION is defined, we'll
- X * use that method.
- X *
- X * *** Warning: this does not work, yet ***
- X */
- X
- X/* #define USE_PIXMAP_ANIMATION */
- X
- X/*
- X * Linear response to control stick inputs can make the plane harder
- X * to fly.
- X */
- X
- X/* #define LINEAR_CONTROL_RESPONSE */
- X
- X/*
- X * Define a library directory to contain the acm files
- X */
- X
- X#define ACM_LIBRARY "/usr/games/lib/acm/"
- X
- X/*
- X * a signal handler function type
- X */
- X
- X#ifdef SIGVOID
- X#define acm_sig_t void /* System V returns void */
- X#else
- X#define acm_sig_t int /* BSD does int's */
- X#endif
- END_OF_FILE
- if test 1193 -ne `wc -c <'acm/fsim/manifest.h'`; then
- echo shar: \"'acm/fsim/manifest.h'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/manifest.h'
- fi
- if test -f 'acm/fsim/mtn' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/mtn'\"
- else
- echo shar: Extracting \"'acm/fsim/mtn'\" \(140 characters\)
- sed "s/^X//" >'acm/fsim/mtn' <<'END_OF_FILE'
- X*mountain
- X5 4
- X1 28000 0 0
- X2 0 16000 0
- X3 -35000 0 0
- X4 0 -14000 0
- X5 0 0 -8200
- X#788b63 3 1 2 5
- X#788b63 3 2 3 5
- X#788b63 3 3 4 5
- X#788b63 3 4 1 5
- END_OF_FILE
- if test 140 -ne `wc -c <'acm/fsim/mtn'`; then
- echo shar: \"'acm/fsim/mtn'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/mtn'
- fi
- if test -f 'acm/fsim/patchlevel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/patchlevel.h'\"
- else
- echo shar: Extracting \"'acm/fsim/patchlevel.h'\" \(85 characters\)
- sed "s/^X//" >'acm/fsim/patchlevel.h' <<'END_OF_FILE'
- X/*
- X * Revision information for acm 2.1
- X */
- X
- X#define REVISION 2
- X#define PATCHLEVEL 1
- END_OF_FILE
- if test 85 -ne `wc -c <'acm/fsim/patchlevel.h'`; then
- echo shar: \"'acm/fsim/patchlevel.h'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/patchlevel.h'
- fi
- if test -f 'acm/fsim/placeCraft.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/placeCraft.c'\"
- else
- echo shar: Extracting \"'acm/fsim/placeCraft.c'\" \(1112 characters\)
- sed "s/^X//" >'acm/fsim/placeCraft.c' <<'END_OF_FILE'
- X/*
- X * xflight : an aerial combat simulator for X
- X *
- X * Written by Riley Rainey, riley@mips.com
- X *
- X * Permission to use, copy, modify and distribute (without charge) this
- X * software, documentation, images, etc. is granted, provided that this
- X * comment and the author's name is retained.
- X *
- X */
- X
- X#include "pm.h"
- X
- Xvoid placeCraft (obj, poly, cnt)
- Xcraft *obj;
- XVPolygon **poly;
- Xint *cnt; {
- X
- X int i, j, k, n;
- X VPoint *q, tmp;
- X VMatrix mtx;
- X VPolygon **p;
- X
- X j = *cnt;
- X
- X VIdentMatrix (&mtx);
- X if (obj->curRoll != 0.0)
- X VRotate (&mtx, XRotation, obj->curRoll);
- X if (obj->curPitch != 0.0)
- X VRotate (&mtx, YRotation, - obj->curPitch);
- X if (obj->curHeading != 0.0)
- X VRotate (&mtx, ZRotation, obj->curHeading);
- X VTranslatePoint (&mtx, obj->Sg);
- X
- X if (obj->cinfo->placeProc != NULL) {
- X (*obj->cinfo->placeProc)(obj, &mtx, poly, cnt);
- X return;
- X }
- X
- X n = obj->cinfo->object->numPolys;
- X p = obj->cinfo->object->polygon;
- X for (i=0; i<n; ++i) {
- X
- X poly[j] = VCopyPolygon(p[i]);
- X for ((k=0, q=poly[j]->vertex); k<poly[j]->numVtces; (++k, ++q)) {
- X VTransform(q, &mtx, &tmp);
- X *q = tmp;
- X }
- X ++j;
- X }
- X
- X *cnt = j;
- X}
- END_OF_FILE
- if test 1112 -ne `wc -c <'acm/fsim/placeCraft.c'`; then
- echo shar: \"'acm/fsim/placeCraft.c'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/placeCraft.c'
- fi
- if test -f 'acm/fsim/rwy2' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/rwy2'\"
- else
- echo shar: Extracting \"'acm/fsim/rwy2'\" \(97 characters\)
- sed "s/^X//" >'acm/fsim/rwy2' <<'END_OF_FILE'
- XRunway
- X4 1
- X1 0 -75.000000 0
- X2 12000 -75 0
- X3 12000 75.000000 0
- X4 0 75.000000 0
- X#b7b19f 4 1 2 3 4
- END_OF_FILE
- if test 97 -ne `wc -c <'acm/fsim/rwy2'`; then
- echo shar: \"'acm/fsim/rwy2'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/rwy2'
- fi
- if test -f 'acm/fsim/scale.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/scale.h'\"
- else
- echo shar: Extracting \"'acm/fsim/scale.h'\" \(621 characters\)
- sed "s/^X//" >'acm/fsim/scale.h' <<'END_OF_FILE'
- Xtypedef struct {
- X int xorg; /* x loc of bottom of scale */
- X int yorg; /* y loc of bottom of scale */
- X int length; /* length of scale (pixels) */
- X int orientation; /* orientation flags */
- X double scale; /* units per pixel */
- X int minorInterval; /* units per minor tick */
- X int minorSize; /* width of minor ticks (pixels) */
- X int majorInterval; /* units per major tick */
- X int majorSize; /* width of major ticks (pixels) */
- X int indexSize; /* width of index (pixels) */
- X double divisor; /* divisor on digit scale */
- X char *format; /* output format */
- X } scaleControl;
- X
- X#define orientRight 1
- X#define orientHorizontal 2
- END_OF_FILE
- if test 621 -ne `wc -c <'acm/fsim/scale.h'`; then
- echo shar: \"'acm/fsim/scale.h'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/scale.h'
- fi
- if test -f 'acm/fsim/tower' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/tower'\"
- else
- echo shar: Extracting \"'acm/fsim/tower'\" \(1158 characters\)
- sed "s/^X//" >'acm/fsim/tower' <<'END_OF_FILE'
- X*-a-control-tower
- X60 16
- X1 20 20 0
- X2 20 -20 0
- X3 12 -12 -60
- X4 12 12 -60
- X5 12 12 -60
- X6 12 -12 -60
- X7 12 -12 -64
- X8 12 12 -64
- X9 12 0.25 -64
- X10 12 -0.25 -64
- X11 12 -0.25 -72
- X12 12 0.25 -72
- X13 14 14 -72
- X14 14 -14 -72
- X15 0 0 -76
- X16 -20 -20 0
- X17 -20 20 0
- X18 -12 12 -60
- X19 -12 -12 -60
- X20 -12 -12 -60
- X21 -12 12 -60
- X22 -12 12 -64
- X23 -12 -12 -64
- X24 -12 -0.25 -64
- X25 -12 0.25 -64
- X26 -12 0.25 -72
- X27 -12 -0.25 -72
- X28 -14 -14 -72
- X29 -14 14 -72
- X30 0 0 -76
- X31 20 20 0
- X32 -20 20 0
- X33 -12 12 -60
- X34 12 12 -60
- X35 12 12 -60
- X36 -12 12 -60
- X37 -12 12 -64
- X38 12 12 -64
- X39 12 0.25 -64
- X40 -12 0.25 -64
- X41 -12 0.25 -72
- X42 12 0.25 -72
- X43 14 14 -72
- X44 -14 14 -72
- X45 0 0 -76
- X46 -20 -20 0
- X47 20 -20 0
- X48 12 -12 -60
- X49 -12 -12 -60
- X50 -12 -12 -60
- X51 12 -12 -60
- X52 12 -12 -64
- X53 -12 -12 -64
- X54 -12 -0.25 -64
- X55 12 -0.25 -64
- X56 12 -0.25 -72
- X57 -12 -0.25 -72
- X58 -14 -14 -72
- X59 14 -14 -72
- X60 0 0 -76
- Xblack 4 1 2 3 4
- Xblack 4 5 6 7 8
- Xblack 4 9 10 11 12
- Xblack 3 13 14 15
- Xblack 4 16 17 18 19
- Xblack 4 20 21 22 23
- Xblack 4 24 25 26 27
- Xblack 3 28 29 30
- Xblack 4 31 32 33 34
- Xblack 4 35 36 37 38
- Xblack 4 39 40 41 42
- Xblack 3 43 44 45
- Xblack 4 46 47 48 49
- Xblack 4 50 51 52 53
- Xblack 4 54 55 56 57
- Xblack 3 58 59 60
- END_OF_FILE
- if test 1158 -ne `wc -c <'acm/fsim/tower'`; then
- echo shar: \"'acm/fsim/tower'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/tower'
- fi
- if test -f 'acm/fsim/transpose.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/transpose.c'\"
- else
- echo shar: Extracting \"'acm/fsim/transpose.c'\" \(454 characters\)
- sed "s/^X//" >'acm/fsim/transpose.c' <<'END_OF_FILE'
- X/*
- X * xflight : an aerial combat simulator for X
- X *
- X * Written by Riley Rainey, riley@mips.com
- X *
- X * Permission to use, copy, modify and distribute (without charge) this
- X * software, documentation, images, etc. is granted, provided that this
- X * comment and the author's name is retained.
- X *
- X */
- X
- X#include <Vlib.h>
- X
- Xint transpose (m, r)
- XVMatrix *m, *r; {
- X
- X int i, j;
- X
- X for (i=0; i<4; ++i)
- X for (j=0; j<4; ++j)
- X r->m[i][j] = m->m[j][i];
- X return 0;
- X}
- END_OF_FILE
- if test 454 -ne `wc -c <'acm/fsim/transpose.c'`; then
- echo shar: \"'acm/fsim/transpose.c'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/transpose.c'
- fi
- if test -f 'acm/fsim/update.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/update.c'\"
- else
- echo shar: Extracting \"'acm/fsim/update.c'\" \(1141 characters\)
- sed "s/^X//" >'acm/fsim/update.c' <<'END_OF_FILE'
- X/*
- X * xflight : an aerial combat simulator for X
- X *
- X * Written by Riley Rainey, riley@mips.com
- X *
- X * Permission to use, copy, modify and distribute (without charge) this
- X * software, documentation, images, etc. is granted, provided that this
- X * comment and the author's name is retained.
- X *
- X */
- X
- X#include "pm.h"
- X#include <X11/Xutil.h>
- X
- Xextern int flightCalculations();
- Xextern int missileCalculations();
- Xextern void doEvents(), doViews(), flapControl();
- X
- Xint cur = 0;
- X
- Xint redraw () {
- X
- X int i;
- X craft *p;
- X
- X for ((i=0, p=ptbl); i<MAXPLAYERS; (++i, ++p)) {
- X if (p->type == CT_PLANE) {
- X doEvents (p);
- X if (flightCalculations (p) == 1)
- X killPlayer (p);
- X doWeaponUpdate (p);
- X flapControl (p);
- X }
- X else if (p->type == CT_DRONE)
- X if (droneCalculations (p) == 1)
- X killPlayer (p);
- X }
- X
- X for ((i=0, p=mtbl); i<MAXPROJECTILES; (++i, ++p)) {
- X if (p->type == CT_MISSILE) {
- X if (missileCalculations (p) == 1)
- X killMissile (p);
- X }
- X else if (p->type == CT_CANNON)
- X if (cannonCalculations (p) == 1)
- X killMissile (p);
- X }
- X
- X lookForImpacts ();
- X
- X if (cur++ % REDRAW_EVERY == 0)
- X doViews ();
- X
- X curTime += deltaT;
- X
- X return 0;
- X
- X}
- END_OF_FILE
- if test 1141 -ne `wc -c <'acm/fsim/update.c'`; then
- echo shar: \"'acm/fsim/update.c'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/update.c'
- fi
- if test -f 'acm/fsim/weapon.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/fsim/weapon.c'\"
- else
- echo shar: Extracting \"'acm/fsim/weapon.c'\" \(1276 characters\)
- sed "s/^X//" >'acm/fsim/weapon.c' <<'END_OF_FILE'
- X/*
- X * xflight : an aerial combat simulator for X
- X *
- X * Written by Riley Rainey, riley@mips.com
- X *
- X * Permission to use, copy, modify and distribute (without charge) this
- X * software, documentation, images, etc. is granted, provided that this
- X * comment and the author's name is retained.
- X *
- X */
- X
- X#include <string.h>
- X#include "pm.h"
- X
- Xint selectWeapon(c)
- Xcraft *c; {
- X
- X register int n, m;
- X
- X m = c->curWeapon;
- X n = (c->curWeapon + 1) % WEAPONTYPES;
- X for (; n != m; n = (n + 1) % WEAPONTYPES) {
- X if (wtbl[n].select != NULL)
- X if ((*wtbl[n].select)(c) == 1) {
- X c->curWeapon = n;
- X return 1;
- X }
- X }
- X
- X return 0;
- X}
- X
- Xint fireWeapon (c)
- Xcraft *c; {
- X
- X if (wtbl[c->curWeapon].firePress != NULL)
- X return (*wtbl[c->curWeapon].firePress)(c);
- X
- X return 0;
- X}
- X
- Xint ceaseFireWeapon (c)
- Xcraft *c; {
- X
- X if (wtbl[c->curWeapon].fireRelease != NULL)
- X return (*wtbl[c->curWeapon].fireRelease)(c);
- X
- X return 0;
- X}
- X
- Xint doWeaponDisplay (c, u)
- Xcraft *c;
- Xviewer *u; {
- X
- X int i;
- X
- X if (wtbl[c->curWeapon].display != NULL)
- X return (*wtbl[c->curWeapon].display)(c, wtbl[c->curWeapon].w, u);
- X else {
- X for (i=0; i<3; i++)
- X strcpy (c->leftHUD[i], "");
- X }
- X
- X return 0;
- X}
- X
- Xint doWeaponUpdate (c)
- Xcraft *c; {
- X
- X if (wtbl[c->curWeapon].update != NULL)
- X return (*wtbl[c->curWeapon].update)(c);
- X
- X return 0;
- X}
- END_OF_FILE
- if test 1276 -ne `wc -c <'acm/fsim/weapon.c'`; then
- echo shar: \"'acm/fsim/weapon.c'\" unpacked with wrong size!
- fi
- # end of 'acm/fsim/weapon.c'
- fi
- if test -f 'acm/install-objects' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'acm/install-objects'\"
- else
- echo shar: Extracting \"'acm/install-objects'\" \(268 characters\)
- sed "s/^X//" >'acm/install-objects' <<'END_OF_FILE'
- X#! /bin/sh
- X#
- X# This script installs acm object description files.
- X# To change this location, you must also change the ACM_LIBRARY definition
- X# in fsim/manifest.h.
- XBINDIR=/usr/games/lib/acm
- X
- Xcd fsim
- Xmkdir $BINDIR
- Xcp f16 mig23 aim-9 bullet mtn rwy rwy2 tower $BINDIR
- END_OF_FILE
- if test 268 -ne `wc -c <'acm/install-objects'`; then
- echo shar: \"'acm/install-objects'\" unpacked with wrong size!
- fi
- chmod +x 'acm/install-objects'
- # end of 'acm/install-objects'
- fi
- echo shar: End of archive 1 \(of 9\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Riley Rainey Internet: riley@mips.com
- MIPS Computer Systems Phone: +1 214 770-7979
- Dallas, Texas
-